﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Stima
{
    public class Grid
    {
        public int[,] map;

        public Grid()
        {
            map = new int[6, 6];
            init_map();
            tulis();
        }

        private void init_map()
        {
            for (int i = 0; i<6;i++)
            {
                for (int j =0; j<6;j++)
                {
                    map[i, j] = 0;
                }
            }
        }
        private void tulis()
        {
            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < 6; j++)
                {
                    Console.Write(" " + map[i, j]);
                }
                Console.WriteLine();
            }
        }

        public int get_map(int x, int y)
        {
            return map[x, y];
        }

        public void set_map(int _type, int _direction, float posX,float posY) 
        {
            for (int i = 0; i < _type; i++)
            {
                if (_direction == 1)
                {
                    map[(int)(posX/100) + i, (int)(posY/100)] = 1;
                }
                else
                {
                    map[(int)(posX/100), (int)(posY/100) + i] = 1;
                }
            }   
        }


        /*other
        public bool isPlaceable(Cars movObj, int X, int Y)
        {
            int rearX, rearY;
            switch (movObj.GetDirection())
            {
                case 1: //up
                    {
                        rearX = X;
                        rearY = Y + (movObj.GetLength() - 1);
                        break;
                    }
                case 2: //right
                    {
                        rearX = X - (movObj.GetLength() - 1);
                        rearY = Y;
                        break;
                    }
                case 3: //down
                    {
                        rearX = X;
                        rearY = Y - (movObj.GetLength() - 1);
                        break;
                    }
                case 4: //left
                    {
                        rearX = X + (movObj.GetLength() - 1);
                        rearY = Y;
                        break;
                    }
                default:
                    {
                        rearX = X;
                        rearY = Y;
                        break;
                    }
            }
            return ((rearX < maxCol) &&
                    (rearX >= 0) &&
                    (rearY < maxRow) &&
                    (rearY >= 0) &&
                    (X < maxCol) &&
                    (X >= 0) &&
                    (Y < maxRow) &&
                    (Y >= 0));
        }*/

    }
   
}
